<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>single_nubot_gazebo: Main Page</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">single_nubot_gazebo
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li class="current"><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Macros</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">single_nubot_gazebo Documentation</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>This simulation system can simulate one robot soccer player for RoboCup Middle Size League. It can be adapted for other purposes.</p>
<h1>Recommended Operating Environment</h1>
<ol type="1">
<li>Ubuntu 14.04;</li>
<li>ROS Indigo or ROS Jade.</li>
<li>Gazebo 5.0 or 5.1 or 7.1;</li>
<li>gazebo_ros_pkgs;</li>
</ol>
<blockquote class="doxtable">
<p><b>NOTE:</b> If you choose "desktop-full" install of ROS Indigo, there is a Gazebo 2.0 included initially. In order to install Gazebo 5.0/5.1, you should first remove Gazebo 2.0 by running:</p>
<p></p>
</blockquote>
<p><code>$ sudo apt-get remove gazebo2*</code> </p>
<blockquote class="doxtable">
<p>Then you should be able to install Gazebo 5.0 now. To install gazebo_ros_pkgs compatible with Gazebo 5.0/5.1, run this command:</p>
<p></p>
</blockquote>
<p><code>$ sudo apt-get install ros-indigo-gazebo5-ros-pkgs ros-indigo-gazebo5-ros-control</code></p>
<p>Other versions of Ubuntu, ROS or Gazebo may also work, but we have not tested yet.</p>
<blockquote class="doxtable">
<p><b>Update:</b> It seems <code>$ sudo apt-get install ros-indigo-gazebo5-ros-pkgs ros-indigo-gazebo5-ros-control</code> no longer works now. These packages may be moved to other places. You can checkout <a href="https://github.com/ros-simulation/gazebo_ros_pkgs.git,">https://github.com/ros-simulation/gazebo_ros_pkgs.git,</a> download and install this package. A workaround is installing ROS Jade, which has gazebo_ros_pkgs in it; so you don't have to install it again. However, you should do the following steps to fix some of the bugs in ROS Jade:</p>
<p></p>
</blockquote>
<blockquote class="doxtable">
<p>(a) <code>$ sudo gedit /opt/ros/jade/lib/gazebo_ros/gazebo</code> In this file, go to line 24 and delete the last '/'. So <code>setup_path=$(pkg-config --variable=prefix gazebo)/share/gazebo/</code> is changed to <code>setup_path=$(pkg-config --variable=prefix gazebo)/share/gazebo</code> You can read this link for more information: "http://answers.ros.org/question/215796/problem-for-install-gazebo_ros_package/" (b) Install Gazebo 5. <code>$ sudo apt-get install gazebo5</code> If this fails, try to run the 'gazebo5_install.sh' in this directoy. Read for more information "http://answers.ros.org/question/217970/ros-jade-and-gazebo-50-migration-problem/" (c) Optional: copy resource files to the new gazebo folder. <code>$ sudo cp -r /usr/share/gazebo-5.0/* /usr/share/gazebo-5.1</code></p>
<p></p>
</blockquote>
<h1>Complie</h1>
<ol type="1">
<li>Go to the package root directory (single_nubot_gazebo)</li>
<li><p class="startli">If you already have CMakeLists.txt in the "src" folder, then you can skip this step. If not, run these commands:</p>
<p class="startli">``` $ cd src $ catkin_init_workspace $ cd .. ```</p>
</li>
<li>$ ./configure</li>
<li>$ catkin_make &ndash;pkg <a class="el" href="namespacenubot__common.html">nubot_common</a></li>
<li>$ catkin_make</li>
</ol>
<h1>Tutorials</h1>
<h2>Part I. Overview</h2>
<p>The robot movement is realized by a Gazebo model plugin which is called "NubotGazebo" generated by source files "nubot_gazebo.cc" and "nubot_gazebo.hh". Basically the essential part of the plugin is realizing basic motions: omnidirectional locomotion, ball-dribbling and ball-kicking.</p>
<p>Basically, this plugin subscribes to topic "nubotcontrol/velcmd" for omnidirecitonal movement and subscribes to service "BallHandle" and "Shoot" for ball-dribbling and ball-kicking respectively. You can customize this code for your robot based on these messages and services as a convenient interface.</p>
<p>As for ball-dribbling, there are three ways for a robot to dribble a ball, i.e.</p>
<table class="doxtable">
<tr>
<th align="center">Method </th><th>Description  </th></tr>
<tr>
<td align="center">(a) Setting ball pose continually </td><td>This is the most accurate one; nubot would hardly lose control of the ball, but the visual effect is not very good (the ball does not rotate). </td></tr>
<tr>
<td align="center">(b) Setting ball secant velocity </td><td>This is less acurate than method (a) but more accurate than method (c). </td></tr>
<tr>
<td align="center">(c) Setting ball tangential velocity </td><td>This is the least accurate. If the robot moves fast, such as 3 m/s, it would probably lose control of the ball. However, this method achieves the best visual effect under low-speed condition. </td></tr>
</table>
<p><b>By default, we use method (c) for ball-dribbling.</b></p>
<p>As for Gaussian noise, <b>by default, Gaussian noise is NOT added</b>, but you can add it by changing the flag in <a class="el" href="nubot__gazebo_8cc.html">nubot_gazebo.cc</a> in function update_model_info();</p>
<p>Please read the paper "Weijia Yao et al., A Simulation System Based on ROS and Gazebo for RoboCup Middle Size League, 2015" for more information.</p>
<h2>Part II. Single robot automatic movement</h2>
<p>The robot will do motions according to states transfer graph. Steps are as follows:</p>
<ol type="1">
<li>Go to the package root directory (single_nubot_gazebo)</li>
<li>source the setup.bash file: <code>$ source devel/setup.bash</code></li>
<li><code>$ roslaunch <a class="el" href="namespacenubot__gazebo.html">nubot_gazebo</a> sdf_nubot.launch</code></li>
</ol>
<blockquote class="doxtable">
<p><b>Note:</b> Every time you open a new terminal, you have to do step 2. You can also write this command into the ~/.bashrc file so that you don't have to source it every time.</p>
<p></p>
</blockquote>
<p>Finally, the robot rotates and translates with trajectory planning. That is, the robot accelerates at constant acceleration and stays at constant speed when it reaches the maximum velocity.</p>
<h2>Part III. Keyboad control robot movement</h2>
<ol type="1">
<li>In <a class="el" href="nubot__gazebo_8cc.html">nubot_gazebo.cc</a>, comment "nubot_auto_control();" and uncomment "nubot_be_control();" in function UpdateChild().</li>
<li>Compile again and follow steps 1-3 listed in Part II.</li>
<li><code>$ rosrun <a class="el" href="namespacenubot__gazebo.html">nubot_gazebo</a> nubot_teleop_keyboard</code></li>
</ol>
<h2>Part IV. Appendix</h2>
<ol type="1">
<li>To launch an empty soccer field: <code>$ roslaunch <a class="el" href="namespacenubot__gazebo.html">nubot_gazebo</a> empty_field.launch</code></li>
<li>To launch the simulation world with rqt_plot of nubot or ball's velocity: <code>$ roslaunch <a class="el" href="namespacenubot__gazebo.html">nubot_gazebo</a> sdf_nubot.launch plot:=true</code></li>
</ol>
<h2>Q&amp;A</h2>
<ol type="1">
<li>How to use Gazebo 5 in ROS Jade? (This code works in ROS jade) It seems there is a bug in the configuration of Gazebo 5.0 in ROS Jade. So the solution is as follows(steps): (a) <code>$ sudo gedit /opt/ros/jade/lib/gazebo_ros/gazebo</code>. In this file, go to line 24 and delete the last '/'. So 'setup_path=$(pkg-config &ndash;variable=prefix gazebo)/share/gazebo/' is changed to 'setup_path=$(pkg-config &ndash;variable=prefix gazebo)/share/gazebo'. You can read this link for more information: '<a href="http://answers.ros.org/question/215796/problem-for-install-gazebo_ros_package/'">http://answers.ros.org/question/215796/problem-for-install-gazebo_ros_package/'</a> (b) Install Gazebo 5. <code>$ sudo apt-get install gazebo5</code>. If this fails, try to run the 'gazebo5_install.sh' in this directoy. Read for more information: '<a href="http://answers.ros.org/question/217970/ros-jade-and-gazebo-50-migration-problem/'">http://answers.ros.org/question/217970/ros-jade-and-gazebo-50-migration-problem/'</a> (c) Optional: copy resource files to the new gazebo folder. <code>$ sudo cp -r /usr/share/gazebo-5.0/* /usr/share/gazebo-5.1</code></li>
<li>How to install gazebo 7.1 and gazebo_ros_pkgs with ROS Jade? (1) Install ROS jade; (2) Go to gazebosim.org and install gazebo 7.0; (3) Go to the github website and download the repository of gazebo_ros_pkgs on the branch 'kinetic-devel': <code>$ git clone <a href="https://github.com/ros-simulation/gazebo_ros_pkgs.git">https://github.com/ros-simulation/gazebo_ros_pkgs.git</a> -b kinetic-devel</code> (4) Go to gazebo_ros_pkgs and create src/, put all other files or folders inside src/. <code>$ cd src/</code> <code>$ catkin_init_workspace</code> (5) To install dependencies, run <code>$ cd ../../</code> <code>$ rosdep install --from-paths gazebo_ros_pkgs --ignore-src --rosdistro=ROSDISTRO</code>. Here, ROSDISTRO is the distribution of your ROS, such as jade or kinetic. (6) Then install all these files to /opt/ros/jade <code>$ cd gazeo_ros_pkgs</code> <code>$ catkin_make -DCMAKE_INSTALL_PREFIX=/opt/ros/jade install</code> </li>
</ol>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sat Jul 30 2016 00:26:42 for single_nubot_gazebo by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>
